home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 22 / PCPP #22.iso / Quake2 / q2source_12_11 / utils3 / bsp / qrad3 / qrad.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-24  |  2.9 KB  |  138 lines

  1.  
  2. #include "cmdlib.h"
  3. #include "mathlib.h"
  4. #include "bspfile.h"
  5. #include "polylib.h"
  6. #include "threads.h"
  7. #include "lbmlib.h"
  8.  
  9. #ifdef WIN32
  10. #include <windows.h>
  11. #endif
  12.  
  13. typedef enum
  14. {
  15.     emit_surface,
  16.     emit_point,
  17.     emit_spotlight
  18. } emittype_t;
  19.  
  20.  
  21.  
  22. typedef struct directlight_s
  23. {
  24.     struct directlight_s *next;
  25.     emittype_t    type;
  26.  
  27.     float        intensity;
  28.     int            style;
  29.     vec3_t        origin;
  30.     vec3_t        color;
  31.     vec3_t        normal;        // for surfaces and spotlights
  32.     float        stopdot;        // for spotlights
  33. } directlight_t;
  34.  
  35.  
  36. // the sum of all tranfer->transfer values for a given patch
  37. // should equal exactly 0x10000, showing that all radiance
  38. // reaches other patches
  39. typedef struct
  40. {
  41.     unsigned short    patch;
  42.     unsigned short    transfer;
  43. } transfer_t;
  44.  
  45.  
  46. #define    MAX_PATCHES    65000            // larger will cause 32 bit overflows
  47.  
  48. typedef struct patch_s
  49. {
  50.     winding_t    *winding;
  51.     struct patch_s        *next;        // next in face
  52.     int            numtransfers;
  53.     transfer_t    *transfers;
  54.  
  55.     int            cluster;            // for pvs checking
  56.     vec3_t        origin;
  57.     dplane_t    *plane;
  58.  
  59.     qboolean    sky;
  60.  
  61.     vec3_t        totallight;            // accumulated by radiosity
  62.                                     // does NOT include light
  63.                                     // accounted for by direct lighting
  64.     float        area;
  65.  
  66.     // illuminance * reflectivity = radiosity
  67.     vec3_t        reflectivity;
  68.     vec3_t        baselight;            // emissivity only
  69.  
  70.     // each style 0 lightmap sample in the patch will be
  71.     // added up to get the average illuminance of the entire patch
  72.     vec3_t        samplelight;
  73.     int            samples;        // for averaging direct light
  74. } patch_t;
  75.  
  76. extern    patch_t        *face_patches[MAX_MAP_FACES];
  77. extern    entity_t    *face_entity[MAX_MAP_FACES];
  78. extern    vec3_t        face_offset[MAX_MAP_FACES];        // for rotating bmodels
  79. extern    patch_t        patches[MAX_PATCHES];
  80. extern    unsigned    num_patches;
  81.  
  82. extern    int        leafparents[MAX_MAP_LEAFS];
  83. extern    int        nodeparents[MAX_MAP_NODES];
  84.  
  85. extern    float    lightscale;
  86.  
  87.  
  88. void MakeShadowSplits (void);
  89.  
  90. //==============================================
  91.  
  92.  
  93. void BuildVisMatrix (void);
  94. qboolean CheckVisBit (unsigned p1, unsigned p2);
  95.  
  96. //==============================================
  97.  
  98. extern    float ambient, maxlight;
  99.  
  100. void LinkPlaneFaces (void);
  101.  
  102. extern    qboolean    extrasamples;
  103. extern int numbounce;
  104.  
  105. extern    directlight_t    *directlights[MAX_MAP_LEAFS];
  106.  
  107. extern    byte    nodehit[MAX_MAP_NODES];
  108.  
  109. void BuildLightmaps (void);
  110.  
  111. void BuildFacelights (int facenum);
  112.  
  113. void FinalLightFace (int facenum);
  114.  
  115. qboolean PvsForOrigin (vec3_t org, byte *pvs);
  116.  
  117. int TestLine_r (int node, vec3_t start, vec3_t stop);
  118.  
  119. void CreateDirectLights (void);
  120.  
  121. dleaf_t        *PointInLeaf (vec3_t point);
  122.  
  123.  
  124. extern    dplane_t    backplanes[MAX_MAP_PLANES];
  125. extern    int            fakeplanes;                    // created planes for origin offset 
  126.  
  127. extern    float    subdiv;
  128.  
  129. extern    float    direct_scale;
  130. extern    float    entity_scale;
  131.  
  132. int    PointInLeafnum (vec3_t point);
  133. void MakeTnodes (dmodel_t *bm);
  134. void MakePatches (void);
  135. void SubdividePatches (void);
  136. void PairEdges (void);
  137. void CalcTextureReflectivity (void);
  138.